$(function(){
    var footHeight = document.documentElement.clientHeight;
    $(".footBox").css('height',footHeight-560);
    $(".name.logon-input").val(localStorage.userName);
    $(".passwd.logon-input").val(localStorage.userPass);
    var verifyCode = new GVerify("v_container");
    $(".login-btn").click(function () {
     if ($(".chekimg").attr("src")=="static/img/checkBox.png"){
         var res = verifyCode.validate($(".yzm").val());
         if(res){
             $.get("front/user/login.do",{"phone":$(".name").val(),"password":$(".passwd").val()},function(result){
                 if(result.code==0){
                	 window.localStorage.customerNo = result.data.customerNo;
                     window.location.href="front/login.do";
                 }else{
                     alert(result.message);
                 }
             })
         }else{
             alert("验证码错误");
         }
     }else if($(".chekimg").attr("src")=="static/img/checkBox1.png")
    {
        var res = verifyCode.validate($(".yzm").val());
        window.localStorage.userName = $(".name.logon-input").val();
        window.localStorage.userPass = $(".passwd.logon-input").val();
            if (res) {
                $.get("front/user/login.do", {
                    "phone": $(".name").val(),
                    "password": $(".passwd").val()
                }, function (result) {
                    if (result.code == 0) {
                    	window.localStorage.customerNo = result.data.customerNo;
                        window.location.href = "front/login.do";
                    } else {
                        alert(result.message);
                    }
                })
            } else {
                alert("验证码错误");
            }

    }

    })

    
    $(".hyz").click(function() {
        $("#verifyCanvas").trigger('click');
    })
    
    $(".chekimg").click(function () {
        var dizhi = $(".chekimg").attr("src");
        if (dizhi == "static/img/checkBox1.png"){
            $(".chekimg").attr("src","static/img/checkBox.png")
        }else if (dizhi == "static/img/checkBox.png"){
            $(".chekimg").attr("src","static/img/checkBox1.png")
        }
    })
    $(".zddl").click(function () {
        var dizhi = $(".chekimg").attr("src");
        if (dizhi == "static/img/checkBox1.png"){
            $(".chekimg").attr("src","static/img/checkBox.png")
        }else if (dizhi == "static/img/checkBox.png"){
            $(".chekimg").attr("src","static/img/checkBox1.png")
        }
    })
    $("#logo").click(function () {
        window.location.href="qzsmk.html"
    })
})